<template>
  <div v-loading="loading">
    <el-row :gutter="24">
      <!-- 左上角：基本信息 -->
      <el-col :span="8" class="detail-info-item">
  <el-card shadow="never">
    <template #header>
      <slot name="header">立项报价</slot>
    </template>
    <el-row>
   
      <el-col :span="24">
        <el-table 
      :data="list" 
    > 
      <el-table-column align="center" label="展项" prop="zx" width="120px" /> 
      <el-table-column align="center" label="需求" prop="xq" width="120px" /> 
      <el-table-column align="center" label="描述" prop="ms"  /> 
      <el-table-column align="center" label="数量" prop="sl"   />  
      <el-table-column align="center" label="成本" prop="cb"  />     
      
    </el-table> 
      </el-col>
    </el-row>
  </el-card>
      </el-col>
      <el-col :span="8">
        <el-card shadow="never">
    <template #header>
      <slot name="header">变更报价</slot>
    </template>  
        <el-table 
      :data="list2" 
:row-class-name="tableRowClassName"
    > 
      <el-table-column   align="center" label="展项" prop="zx" width="120px" /> 
      <el-table-column align="center" label="需求" prop="xq" width="120px" /> 
      <el-table-column align="center" label="描述" prop="ms"  /> 
      <el-table-column align="center" label="数量" prop="sl"   />  
      <el-table-column align="center" label="成本" prop="cb"  />     
      
    </el-table> 
  </el-card>
      </el-col>
      <el-col :span="8">
        <el-card shadow="never">
    <template #header>
      <slot name="header">结算报价</slot>
    </template>  
        <el-table 
      :data="list3" 
    > 
      <el-table-column align="center" label="展项" prop="zx" width="120px" /> 
      <el-table-column align="center" label="需求" prop="xq" width="120px" /> 
      <el-table-column align="center" label="描述" prop="ms"  /> 
      <el-table-column align="center" label="数量" prop="sl"   />  
      <el-table-column align="center" label="成本" prop="cb"  />     
      
    </el-table> 
  </el-card>
      </el-col>
    </el-row>
  </div>

  <!-- 表单弹窗：添加/修改 -->
  <UserForm ref="formRef" @success="getUserData(id)" />
</template>
<script lang="ts" setup>
import * as WalletApi from '@/api/pay/wallet/balance'
import * as UserApi from '@/api/member/user'
import { useTagsViewStore } from '@/store/modules/tagsView'
import UserForm from '@/views/member/user/UserForm.vue'
import UserAccountInfo from './UserAccountInfo.vue'
import daigouyingjian from './daigouyingjian.vue'
import UserBasicInfo from './UserBasicInfo.vue'
import UserBrokerageList from './UserBrokerageList.vue'
import jilu from './jilu.vue'
import ruanjiankaifa from './ruanjiankaifa.vue'
import wuliu from './wuliu.vue'
import neirongzhizuo from './neirongzhizuo.vue'
import sucaidaigou from './sucaidaigou.vue'
import qita from './qita.vue'
import renli from './renli.vue'
import dingzhiruanjian from './dingzhiruanjian.vue'
import { CardTitle } from '@/components/Card/index'
import { ElMessage } from 'element-plus'

defineOptions({ name: 'MemberDetail' })

const loading = ref(false) // 加载中
const user = ref<UserApi.UserVO>({} as UserApi.UserVO)

/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string) => {
  formRef.value.open(type, id)
}

/** 获得用户 */
const getUserData = async (id: number) => {
  loading.value = true
  try {
    user.value = await UserApi.getUser(id)
  } finally {
    loading.value = false
  }
}

const list = [{zx:'展台1',xq:'手机',ms:'-',sl:10,cb:100},{zx:'展台1',xq:'手环',ms:'-',sl:10,cb:100}]
const list2 = [{zx:'展台1',xq:'手机',ms:'-',sl:10,cb:100,type:1},{zx:'展台1',xq:'手环',ms:'-',sl:10,cb:10,type:2}]
const list3 = []

/** 初始化 */
const { currentRoute } = useRouter() // 路由
const { delView } = useTagsViewStore() // 视图操作
const route = useRoute()
const id = Number(route.params.id)
/* 用户钱包相关信息 */
const WALLET_INIT_DATA = {
  balance: 0,
  totalExpense: 0,
  totalRecharge: 0
} as WalletApi.WalletVO // 钱包初始化数据
const wallet = ref<WalletApi.WalletVO>(WALLET_INIT_DATA) // 钱包信息

/** 查询用户钱包信息 */
const getUserWallet = async () => {
  if (!id) {
    wallet.value = WALLET_INIT_DATA
    return
  }
  const params = { userId: id }
  wallet.value = (await WalletApi.getWallet(params)) || WALLET_INIT_DATA
}

const tableRowClassName = ({row, rowIndex})=>
{　 
  if(row.type == '2') {　　　　return 'el-row-red'　　}
} 

onMounted(() => { 
})
</script>
<style   >
.el-table tr .el-row-red td .cell{
  color:red !important;
} 
 
</style>
